| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571 |
- <template>
- <div id="newsList">
- <!-- 页面头部 -->
- <HomePageHead></HomePageHead>
- <!-- 导航栏 -->
- <HomePageNavigation></HomePageNavigation>
- <!-- 二级标题-->
- <!--<div class="sannongzhichuang" v-if="parent_name != ''">
- <div class="inner">
- <h2>
- <NuxtLink :to="`/${parent_pinyin}/index.html`"> {{ parent_name }}</NuxtLink>
- <em class="iconfont icon-xingzhuang-zhijiaosanjiaoxing-copy"></em>
- </h2>
- <p class="introduction">
- <strong>频道介绍</strong>
- <div v-for="(item, index) in secondNav" :key="index">
- <span v-if="index <= 7">
- <NuxtLink :to="{ path: `/${item.aLIas_pinyin}/list-1.html`}">{{ item.alias }}</NuxtLink>
- </span>
- <b v-else></b>
- </div>
- </p>
- </div>
- </div>-->
- <!-- 面包屑导航 -->
- <div class="breadcrumb-box">
- <div class="inner">
- <span class="location">当前位置:</span>
- <el-breadcrumb :separator-icon="ArrowRight">
- <el-breadcrumb-item>
- <NuxtLink to="/">首页</NuxtLink>
- </el-breadcrumb-item>
- <el-breadcrumb-item v-if="parent_name !=''">
- <NuxtLink :to="`/${parent_pinyin}/index.html`"> {{ parent_name }}</NuxtLink>
- </el-breadcrumb-item>
- <el-breadcrumb-item>{{ name }}</el-breadcrumb-item>
- </el-breadcrumb>
- </div>
- </div>
- <!-- 资讯列表 -->
- <div class="newsList">
- <div class="listBox">
- <div class="listBoxLeft">
- <ul class="list">
- <li v-for="(item, index) in newsList" :key="index">
- <NuxtLink :href="getLinkPathDetail(item)" :title="item.alias">
- {{ item.title }}
- </NuxtLink>
- <p>
- <NuxtLink :href="getLinkPathDetail(item)" :title="item.alias">
- {{ item.title }}
- </NuxtLink>
- </p>
- </li>
- </ul>
- <!-- 分页器 -->
- <div class="pagination" v-if="total > 0">
- <el-pagination
- size="small"
- background
- layout="prev, pager, next"
- :total="total"
- class="mt-4"
- :page-size="pageSize"
- :current-page="pageNum"
- prev-text="上一页"
- next-text="下一页"
- @current-change="changePage"
- />
- <span class="total">共{{ total }}条</span>
- </div>
- </div>
- <div class="listBoxRight">
- <!-- <DetailHotNews></DetailHotNews> -->
- <DetailHotNews2></DetailHotNews2>
- </div>
- </div>
- </div>
- <!-- 页面底部 -->
- <HomeFoot></HomeFoot>
- </div>
- </template>
- <script setup>
- //1.页面必备依赖 start ---------------------------------------->
- import { ElBreadcrumb, ElBreadcrumbItem, ElPagination } from 'element-plus'
- import { ArrowRight } from '@element-plus/icons-vue'
- import { ref, onMounted } from 'vue';
- //当前列表名称
- const name = ref('')
- const { $webUrl, $CwebUrl, $BwebUrl } = useNuxtApp()
- //格式化跳转路径
- const getLinkPathDetail = (item) => {
- if (item.islink == 1) {
- return `${item.linkurl}`;
- } else {
- return `/${item.pinyin}/${item.id}.html`;
- }
- }
- //1.页面必备依赖 end ---------------------------------------->
- //1.获得路由id start ---------------------------------------->
- const route = useRoute();
- let articleId = 0;//路由id
- let pageNum = ref(2);
- let total = ref(1);
- let pageSize = ref(10);
- //获得当前的完整路径
- const fullPath = route.path;
- //拆分,取出来中间这一段,然后提取数字部分
- const segments = fullPath.split('/');
- const targetSegment = segments[1];
- //通过导航路径反向查询导航id
- const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
- method: 'GET',
- query: {
- 'pinyin': targetSegment,
- },
- });
- if(getRouteId.code == 200){
- articleId = getRouteId.data.category_id
- }else{
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- console.log("错误位置:通过url路径查询导航池id")
- console.log("后端错误反馈:",getRouteId.message)
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- }
- pageNum.value = parseInt(route.params.id);
- //1.获得路由id end ---------------------------------------->
- //2.页面数据 start ---------------------------------------->
- //2.2新闻列表
- const newsList = ref([]);
- let newslists = async () => {
- const listData = await requestDataPromise('/web/getWebsiteArticleList', {
- method: 'GET',
- query: {
- 'page': pageNum.value,
- 'pageSize': pageSize.value,
- 'catid': articleId
- },
- });
- if (listData.code == 200) {
- newsList.value = listData.data.rows;
- total.value = listData.data.count;
- } else {
- // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- // console.log("错误位置:获取新闻列表")
- // console.log("后端错误反馈:", listData.message)
- // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- }
- }
- //获得列表
- newslists();
- //分页事件
- let changePage = (value) => {
- console.log("当前页码", value);
- navigateTo(`/${targetSegment}/list-${value}.html`)
- }
- //2.3获得页面名称
- let getPageName = async () => {
- const pageName = await requestDataPromise('/web/getOneWebsiteCategory', {
- method: 'GET',
- query: {
- 'catid': articleId
- },
- });
- if (pageName.code == 200) {
- name.value = pageName.data.alias
- } else {
- // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- // console.log("错误位置:设置页面标题")
- // console.log("后端错误反馈:", pageName.message)
- // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- }
- }
- //获得列表
- getPageName();
- //2.页面数据 end ---------------------------------------->
- //3.二级栏目 start ---------------------------------------->
- //3.1通过id获取父栏目
- const parent_name = ref([]);
- const parent_id = ref([]);
- const parent_pinyin = ref("");
- let getParentNav = async () => {
- const listData = await requestDataPromise('/web/getOneWebsiteCategory', {
- method: 'GET',
- query: {
- 'catid': articleId
- },
- });
- if (listData.code == 200) {
- console.log(111999)
- console.log(listData.data);
- parent_name.value = listData.data.parent_name;
- parent_id.value = listData.data.parent_id;
- parent_pinyin.value = listData.data.parent_pinyin;
- } else {
- // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- // console.log("错误位置:获取新闻列表")
- // console.log("后端错误反馈:", listData.message)
- // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- }
- getSecondNav();
- }
- //获得列表
- getParentNav();
- // 3.2获取二级栏目
- const secondNav = ref([]);
- let getSecondNav = async () => {
- const listData = await requestDataPromise('/web/getWebsiteModelCategory', {
- method: 'GET',
- query: {
- 'placeid': 1,
- 'pid': parent_id.value,
- 'num': 8,
- },
- });
- console.log('listData', listData);
- if (listData.code == 200) {
- secondNav.value = listData.data
- } else {
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- console.log("错误位置:获取新闻列表")
- console.log("后端错误反馈:", listData.message)
- console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- }
- }
- //3.二级栏目 end ---------------------------------------->
- //4.设置seo信息 start---------------------------------------->
- //4.1 设置seo信息
- const setData = await requestDataPromise('/web/getWebsiteCategoryHead', {
- method: 'GET',
- query: {
- 'catid': articleId
- },
- });
- if (setData.code == 200) {
- let seoTitle = setData.data.seo_title;
- let seoDescription = setData.data.seo_description;
- let seoKeywords = setData.data.seo_keywords;
- let seoSuffix = setData.data.suffix;
- let seoName = setData.data.website_name;
- useSeoMeta({
- title: seoTitle + "_" + seoName + "_" + seoSuffix,
- meta: [
- { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix , tagPriority: 10 },
- { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix , tagPriority: 10 },
- { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no',tagPriority: 10 }
- ]
- });
- } else {
- // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- // console.log("错误位置:设置列表页面SEO数据")
- // console.log("后端错误反馈:", setData.message)
- // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
- }
- //4.设置seo信息 end---------------------------------------->
- //5.广告 start---------------------------------------->
- let adImg1 = ref({});
- let adImg2 = ref({});
- onMounted(async () => {
- //从客户端获取行政职能部门 加快打开速度
- const { $webUrl, $CwebUrl } = useNuxtApp();
- //广告1
- let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_list_0001`
- const responseAd1 = await fetch(url, {
- headers: {
- 'Content-Type': 'application/json',
- 'Userurl': $CwebUrl,
- 'Origin': $CwebUrl
- }
- });
- const resultAd1 = await responseAd1.json();
- adImg1.value = resultAd1.data[0];
-
- //广告2
- let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_list_0002`
- const responseAd2 = await fetch(url2, {
- headers: {
- 'Content-Type': 'application/json',
- 'Userurl': $CwebUrl,
- 'Origin': $CwebUrl
- }
- });
- const resultAd2 = await responseAd2.json();
- adImg2.value = resultAd2.data[0];
- })
- //5.广告 end---------------------------------------->
- </script>
- <style lang="less" scoped>
- //面包屑
- .breadcrumb-box {
- width: 1400px;
- margin: 0 auto;
- .inner {
- width: 100%;
- height: 22px;
- margin-top: 20px;
- margin-bottom: 20px;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 20px;
- color: #666666;
- line-height: 23px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- display: flex;
- align-items: center;
- border-bottom: 1px dashed #ccc;
- margin-bottom: 10px;
- padding: 20px 20px 20px 0;
- box-sizing: border-box;
- a {
- font-size: 16px;
- color: #000;
- line-height: 20px;
- }
- span {
- font-size: 16px;
- color: #000;
- line-height: 20px;
- &.location {
- line-height: 20px;
- }
- }
- }
- }
- //资讯列表
- .newsList {
- width: 1400px;
- margin: 0 auto;
- .listBox {
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- .listBoxLeft {
- width: 1030px;
- .list {
- >li {
- width: 100%;
- height: auto;
- overflow: hidden;
- border-bottom: 1px dashed #ccc;
- margin-top: 30px;
- padding-bottom: 30px;
- a {
- color: #337ab7;
- text-decoration: none;
- display: block;
- width: 100%;
- height: 22px;
- line-height: 22px;
- font-size: 20px;
- font-weight: bold;
- color: #333;
- overflow: hidden;
- word-break: keep-all;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- p {
- a {
- width: 100%;
- height: 72px;
- line-height: 24px;
- overflow: hidden;
- font-size: 14px;
- color: #666;
- font-weight: normal;
- }
- }
- }
- }
- }
- .listBoxRight {
- width: 315px;
- overflow: hidden;
- }
- }
- }
- //分页
- .pagination {
- height: 34px;
- display: flex;
- justify-content: center;
- margin: 0;
- width: 100%;
- overflow: hidden;
- margin: 20px 0;
- padding: 20px 0;
- // 鼠标移入后字体颜色
- .el-pagination::v-deep :hover {
- color: #139609;
- }
- .el-pagination.is-background::v-deep .btn-next,
- .el-pagination.is-background::v-deep .btn-prev {
- width: 70px;
- height: 34px;
- margin: 0px 10px;
- border-radius: 4px;
- }
- .el-pagination.is-background::v-deep .el-pager li {
- margin: 0px 10px;
- width: 38px;
- height: 34px;
- border-radius: 4px;
- }
- .el-pagination.is-background::v-deep .btn-next.is-active,
- .el-pagination.is-background::v-deep .btn-prev.is-active,
- .el-pagination.is-background::v-deep .el-pager li.is-active {
- background-color: #337ab7;
- color: #fff;
- }
- .total {
- display: block;
- height: 34px;
- line-height: 34px;
- font-size: 18px;
- margin-left: 20px;
- }
- }
- .breadcrumb-box{width:1400PX;margin:0px auto 0px; }
- .el-breadcrumb{height:22PX;line-height:22PX;}
- .breadcrumb-box .inner span.location{font-size:16PX;;height:22PX;;line-height:22PX; font-weight:normal;}
- .breadcrumb-box .inner a{font-size:16PX;;height:22PX;line-height:22PX;display:inline-block; font-weight:normal;}
- .breadcrumb-box .phone_breadcrumb_text /deep/.el-breadcrumb__inner{font-size:16PX;;height:22PX;line-height:22PX;
- font-weight:normal;}
- .breadcrumb-box:deep(.el-icon){width:16PX;height:16PX;}
- .breadcrumb-box .inner span{font-size:16PX;;height:22PX;line-height:22PX;}
- .newsList{width:1400PX;box-sizing:border-box; }
- .newsList .listBox{display:block;width:100%;overflow:hidden;}
- .newsList .listBox .listBoxLeft{float:left;width:64%;overflow:hidden;}
- .newsList .listBox .listBoxRight{float:right;width:33%;overflow:hidden;}
- .newsList .listBox .listBoxLeft .list > li{display:block;
- margin-top:22PX;padding-bottom:22PX;}
-
- .li_img_box{float:left;width:160PX;height:110PX;margin-right:11px;}
- .li_img_box *{display:block;width:100%;height:100%;}
- .li_right_box{ }
- .li_h4_dot1{height:22PX;line-height:22PX;font-size:20PX;font-weight:bold;color:#333;
- display:block;word-break: keep-all; white-space: nowrap;overflow:hidden;text-overflow:ellipsis;
- }
- .li_dot3{height:72PX;line-height:24PX;font-size:14PX;color:#333;
- font-weight:normal;margin-top:4px;
- overflow:hidden;display:-webkit-box!important;-webkit-box-orient:vertical;-webkit-line-clamp:3;
- }
- .newsList .listBox .listBoxLeft .list > li a{display:block;width:100%;
- height:auto;overflow:hidden;}
- .pagination{padding:10px 0px;margin:10px 0px;}
-
- //分页
- .pagination {
- height: 34PX;
- display: flex;
- justify-content: center;
- margin: 0;
- width: 100%;
- overflow: hidden;
- margin: 20PX 0;
- padding: 20PX 0;
- // 鼠标移入后字体颜色
- .el-pagination::v-deep :hover {
- color: #139609;
- }
- .el-pagination.is-background::v-deep .btn-next,
- .el-pagination.is-background::v-deep .btn-prev {
- width: 70PX;
- height: 34PX;
- margin: 0px 10PX;
- border-radius: 4PX;
- }
- .el-pagination.is-background::v-deep .el-pager li {
- margin: 0px 10PX;
- width: 38PX;
- height: 34PX;
- border-radius: 4PX;
- }
- .el-pagination.is-background::v-deep .btn-next.is-active,
- .el-pagination.is-background::v-deep .btn-prev.is-active,
- .el-pagination.is-background::v-deep .el-pager li.is-active {
- background-color: #337ab7;
- color: #fff;
- }
- .total {
- display: block;
- height: 34PX;
- line-height: 34PX;
- font-size: 18PX;
- margin-left: 20PX;
- }
-
-
- }
- @media screen and (min-width: 1401px) {
- //你的样式
- }
- @media screen and (max-width: 1400px) {
- .breadcrumb-box{width:100%;margin:0px auto 0px; box-sizing:border-box;padding:0px 10px;}
- .newsList{width:100%;box-sizing:border-box;padding:0px 10px;margin:0px auto 0px;}
- }
- @media screen and (min-width: 801px) and (max-width: 1400px) {
- //你的样式
- }
- @media screen and (max-width: 800px) {
- //你的样式
-
- .listBoxLeft{width:100%!important;float:none!important;}
- .listBoxRight{width:100%!important;float:none!important;}
- .el-pagination.is-background::v-deep .btn-next,
- .el-pagination.is-background::v-deep .btn-prev {
- width: 60PX!important;
- height: 34PX!important;
- margin: 0px 2PX!important;
-
- }
- .el-pagination.is-background::v-deep .el-pager li {
- margin: 0px 2PX!important;
- width: 34PX!important;
- height: 34PX!important;
-
- }
- }
- </style>
|